package me.zhengjie.modules.quartz.task;

import lombok.extern.slf4j.Slf4j;
import me.zhengjie.modules.fund.domain.Fund;
import me.zhengjie.modules.fund.reptile.FundCrawler;
import me.zhengjie.modules.fund.service.FundService;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

@Slf4j
@Component
public class FundCrawlerTask {

    @Resource
    private FundCrawler fundCrawler;

    @Resource
    private FundService fundService;

    public void run() {
        List<Fund> allFunds = fundCrawler.getAllFunds();
//        log.info("{}", JSON.toJSONString(allFunds));
        fundService.createBatch(allFunds);
    }
}
